<?php if (!defined('BASEPATH'))exit('No direct script access allowed');

class Saran extends CI_Controller
{
    public function index()
    {
        $id_login = $this->session->userdata('id');
        $data['komentar'] = $this->input->post('komentar');
        $data['error'] = false;
        if($id_login != '' && $data['komentar'] != '')
        {
            $this->db->insert('saran', 
                    array('id_login' => $id_login,
                          'komentar' => $data['komentar']
                    ));
            redirect('saran');
        }
        
        $data['rslt_saran'] = $this->db->query('SELECT ul.username, s.komentar, s.tanggal FROM saran s
            INNER JOIN user_login ul ON(ul.id=s.id_login)
            ORDER BY s.tanggal DESC');
        $this->template->home('home/v_saran', $data, "Kritik & Saran");
    }
}

/* End of file saran.php */
/* Location: ./application/controllers/saran.php */